﻿using System;

namespace Less.Core.Model
{
    public class Identifier : IId
    {
        private string _GUID;
        public int Id { get; set; }
        public int UserId { get; set; }
        public string GUID
        {
            get
            {
                if (_GUID == Guid.Empty.ToString())
                    _GUID = Guid.NewGuid().ToString();
                return _GUID;
            }
            set
            {
                _GUID = value;
            }
        }
        public DateTime CreationDate { get; set; }
        public DateTime ExpiryDate { get; set; }
        public DateTime? UsedDate { get; set; }
        public Identifier()
        {
        }
        public Identifier(int id, int userId, string guid, DateTime creationDate, DateTime expiryDate, DateTime? usedDate)
        {
            Id = id;
            UserId = userId;
            GUID = guid;
            CreationDate = creationDate;
            ExpiryDate = expiryDate;
            UsedDate = usedDate;
        }
    }
}